<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>了解编译的作用</title>
</head>
<body>
    <div id="app">
        <cpn></cpn>
        <!-- 使用的是vue实例作用于的isshow -->
		<cpn v-show="ishow"></cpn>
    </div>
    <template id="cpnW"> 
        <div style="border: 2px solid #FF0000; margin: 20px 50px;">
            <h4>这是子组件的内容</h4>
            <!-- 组件作用于，使用子组件的作用域 -->
            <button type="button" v-show="ishow">这是子组件中的按钮</button>
        </div>
    </template>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
    <script>
        let cpn = {
            template:'#cpnW',
            data(){
                return {
                    ishow:false
                }
            }
        }
        new Vue({
            el:'#app',
            data: {
                ishow:true
            },
            components: {
                cpn
            }
        })
    </script>
</body>
</html>